using System;
using System.IO;
using System.Xml;
using System.Xml.Serialization;
using System.Collections.Generic;
using System.Collections;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
using SumGam.Globals;
using SumGam.Structs;
using SumGam.Classes;
namespace SumGam
{
    public static class Loading
    {
        public static void CreateTextures(ContentManager Content, GraphicsDevice Device)
        {
            Textures.TitleScreen = Content.Load<Texture2D>("Titlescreen");
            Textures.BlankTexture = new Texture2D(Device, 1, 1, 0, TextureUsage.None, SurfaceFormat.Color);
            Color[] colArray = new Color[1];
            colArray[0] = Color.White;
            Textures.BlankTexture.SetData<Color>(colArray);
        }
        public static void CreateFonts(ContentManager Content, GraphicsDevice Device)
        {
            Fonts.DialogFont = Content.Load<SpriteFont>("DialogFont");
            Fonts.TitleFont = Content.Load<SpriteFont>("TitleFont");
        }
        public static void CreateMainMenu(ContentManager Content, GraphicsDevice Device)
        {
            States.MainMenu = new MenuState("Main Menu", 400, 3, 10, true, new Color(150, 150, 150, 100), new Color(200, 200, 200, 150), Color.Tomato, Color.Crimson, Fonts.DialogFont, Fonts.TitleFont);
            
            Option Option1 = new Option();
            Option1.Text = "Start Game";
            Option1.Func = delegate()
            {
                for (float x = 0; x <= 10; x++)
                {
                    for (float y = 0; y <= 20; y++)
                    {
                        States.GameState.CurrentScene.Entities.AddEntity(new Boundary(new Vector2((x * 0.5f) + 100, (y * 0.5f) + 150f), 1, 1));
                    }
                }
                States.GameState.CurrentScene.Entities.AddEntity(new TestEntity(new Vector2(100f, 5f), new Vector2(0.5f, 0f)));
                States.GameState.CurrentScene.Entities.AddEntity(new Boundary(new Vector2(200f, 100f), 10, 20));
                Helpers.SetMajorState(States.GameState);
            };
            Option Option2 = new Option();
            Option2.Text = "Return to Titlescreen";
            Option2.Func = delegate()
            {
                Helpers.SetMajorState(States.TitleScreen);
            };
            Option Option3 = new Option();
            Option3.Text = "Credits";
            Option3.Func = delegate()
            {
                Helpers.SetMajorState(States.Attributions);
            };

            States.GameState = new GameState();
            States.MainMenu.AddOption(Option1);
            States.MainMenu.AddOption(Option2);
            States.MainMenu.AddOption(Option3);
        }
        public static void CreateCreditsScreen(ContentManager Content, GraphicsDevice Device)
        {
            States.Attributions = new DialogState("Credits", 400, 3, true, new Color(150, 150, 150, 100), new Color(200, 200, 200, 150), Color.Tomato, Fonts.DialogFont, Fonts.TitleFont);
            States.Attributions.AddPage("---Libraries---\n     [GraphiXNA][Mahdi Khodadadi Fard]\n       http://www.codeplex.com/GraphiXNA");
            States.Attributions.AddPage("---Music---\n     [Evrim Sen - Human][Evrim Sen]\n       http://ccmixter.org/files/Evrim_Sen/11768\n       http://creativecommons.org/licenses/by-nc/3.0/");
            States.Attributions.OnFinish = delegate()
            {
                Helpers.SetMajorState(States.MainMenu);
            };
        }
    }
}